#include "testlib.h"
#include <stdio.h>
#include <algorithm>
using namespace std;
#define N 510
long long x[N], y[N];
int main(int argc, char * argv[])
{
    registerTestlibCmd(argc, argv);
    int n, i, k;
	for(n=ans.readInt(), i=0; i<n; i++)
		x[i]=ans.readInt();
	for(k=ouf.readInt(), i=0; i<k; i++)
		y[i]=ouf.readInt();
	if(n!=k) quitf(_wa, "wrong number of triangles, expected %d, found %d", n, k);
	sort(x, x+n);
	sort(y, y+n);
	for(i=1; i<n; i++)
		if(y[i]==y[i-1]) quitf(_pe, "every triangle must not appear many times");
	for(i=0; i<n; i++)
		if(y[i]<x[i]) quitf(_wa, "extra triangle %Ld", y[i]);
		else if(y[i]>x[i]) quitf(_wa, "missed triangle %Ld", x[i]);
	quitf(_ok, "%d triangles are visible", n);
}